package br.com.cadele.beans;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.cadele.model.Aula;
import br.com.cadele.service.AulaService;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;

@ManagedBean(name="cadastrarAulaBean")
@ViewScoped
@URLBeanName(value="cadastrarAulaBean")
@URLMapping(id="cadastrarAulaBean", pattern="/aula/cadastrar", viewId="/pages/aula/cadastrar.xhtml")
public class CadastrarAulaBean implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -8404107446468945778L;
	private Aula aula;
	private AulaService aulaService;

	@PostConstruct
	public void init(){
		aula = new Aula();
		aulaService = new AulaService();
	}
	
	public void salvar() {
		aulaService.executeInsert(aula);
	}
	
	public Aula getAula() {
		return aula;
	}
	
	public void setAula(Aula aula) {
		this.aula = aula;
	}
}
